<template>
  <div class="main">
    <div class="dialog">
      <div class="content">
        <h1 class="title">{{ propsItem.title }}</h1>
        <div class="mainContent">
          <slot></slot>
        </div>
        <input type="button" class="ok" :value="propsItem.ok" @click="okCallback">
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'DDialog',
  props: {
    //   接受父组件传的值
    propsItem: {
      type: Object
    }
  },
  data() {
    return {
    }
  },
  methods: {
    okCallback() {
      this.$emit('child-ok')
    },
  }
}
</script>

<style scoped>
.content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  width: 80%;
  border-radius: 16px;

  box-sizing: border-box;
  padding: 24px;
  z-index: 999;
  box-shadow: 5px 5px 13px #ccc;

  display: flex;
  flex-direction: column;
  gap: 16px;
}

.title {
  text-align: center;
  margin-block: 0;
  font-size: 20px;
  color: #333333;
  font-weight: 500;
}

.mainContent {
  width: 100%;
  line-height: 30px;

  color: #666666;
  font-size: 16px;

  text-align: center;
}

/* .main {
  width: 100%;
  height: 100%;
} */

.dialog {
  background-color: rgba(0, 0, 0, 0.5);
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 999999px;
  z-index: 999;
}

.ok {
  background: none;
  color: inherit;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  outline: inherit;

  background-color: #1890FF;
  color: #ffffff;
  border-radius: 10px;
  width: 100%;

  font-size: 18px;
  line-height: 40px;
}
</style>